package com.controller.front;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.Quser;
import com.service.front.IQuserService;


@RequestMapping("/front")
@Controller
public class QuserController {
	
	@Autowired
	private IQuserService qs;
	
	@RequestMapping("/login")
	public String login(){
		return "login";
	}
	
	
	
	@RequestMapping("/login_submit")
	public Object login_submit(HttpSession session, String qAccount,String qPwd){
		Quser loginList=qs.isByQuser(qAccount, qPwd);
		if(loginList==null){
			return "redirect:/front/login";
		}
		session.setAttribute("qId", loginList.getqId());
		session.setAttribute("qAccount", loginList.getqAccount());
		session.setAttribute("qPwd", loginList.getqPwd());
		return "redirect:/front/index";
	}
	

	@RequestMapping("/login_zx")
	public String login_zx(HttpSession session){
		session.invalidate();
		return "redirect:/front/index";
	}
	


}
